#include "conditions.hxx"

/*
int condition_demo(METHOD_message_t* method, va_list args) {
	BEGIN;
	END;
}
*/

//TODO: 对象验证(condition)

OUR_type_condition type_conditions[] = {
	//业务对象类型，                      动作名称，             验证函数，    用户参数
	{NULL,                               NULL,                 NULL,        NULL}
};

OUR_prop_condition prop_conditions[] = {
	//业务对象类型，属性名称，             动作名称，             验证函数，    用户参数
	{NULL,         NULL,                 NULL,                 NULL,        NULL}
};

int OUR_register_conditions(int* decision, va_list args) {
	BEGIN;
	int registered = 0;
	int type_condition_size = sizeof(type_conditions) / sizeof(OUR_type_condition) - 1;
	int prop_condition_size = sizeof(prop_conditions) / sizeof(OUR_prop_condition) - 1;
	for (int i = 0; i < type_condition_size; i++) {
		ADD_TYPE_CONDITION(type_conditions[i].business, type_conditions[i].message,
			type_conditions[i].func, type_conditions[i].args);
		if (ITK_ok == ifail)
			registered++;
	}
	for (int i = 0; i < prop_condition_size; i++) {
		ADD_PROP_CONDITION(prop_conditions[i].business, prop_conditions[i].name, prop_conditions[i].message,
			prop_conditions[i].func, prop_conditions[i].args);
		if (ITK_ok == ifail)
			registered++;
	}
	info_syslog("*There are %d/%d conditions in '%s.%s' registered.\n\n",
		registered, type_condition_size + prop_condition_size, EX_STRING(SITE), __FUNCTION__);
	END;
}
